<?php
class User extends EnhancedModel {
    static $validates_presence_of = array(
        array('name','on'=>'create'),
    );

    static $validates_inclusion_of = array(
        array('admin','in' => array(0,1),'message' => 'must be either 0 or 1'),
        array('employee','in' => array(0,1),'message' => 'must be either 0 or 1')
    );

    static $validates_uniqueness_of = array(
        array('name')
    );

    static $validates_format_of = array(
        array('name','with' => '/^[a-zA-Z0-9]+$/'),
        array('email', 'with' =>
          '/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/',
          'message' => 'must be valid')
    );

    static $has_many = array(
        array('reviews'),
        array('carts')
    );

    static $attr_protected = array("id");
}
?>
